---------------------
-- EXPERIMENT X-89 --
---------------------
local Locales = {
	["Experiment X-89"] = {
		[1] = "Experiment X-89",
		[2] = "Experiment X-89",
		[3] = "Expérience X-89",
	},
	["Resounding Shout"] = { --47279
		[1] = "Resounding Shout",
		[2] = "Widerhallender Schrei",
		[3] = "Hurlement retentissant",
	},
	["Repugnant Spew"] = { --47332
		[1] = "Repugnant Spew",
		[2] = "Widerliches Erbrochenes",
		[3] = "Crachat répugnant",
	},
	["Shattering Shockwave"] = { --47271
		[1] = "Shattering Shockwave",
		[2] = "Zerschmetternde Schockwelle",
		[3] = "Onde de choc dévastatrice",
	},
	["Corruption Globule"] = { --47316
		[1] = "Corruption Globule",
		[2] = "Korrumpierungskügelchen",
		[3] = "Globule de corruption",
	},
	["Strain Bomb"] = { --47285
		[1] = "Strain Bomb",
		[2] = "Transmutationsbombe",
		[3] = "Bombe de Souillure",
	},
	["Small bomb! Go to the edge!"] = {
		[1] = "Small bomb! Go to the edge!",
		[2] = "Kleine Bombe! An den Rand!",
		[3] = "Petite bombe! Allez au bord!",
	},
	["BIG bomb! Jump down!"] = {
		[1] = "BIG bomb! Jump down!",
		[2] = "Große Bombe! Runterspringen!",
		[3] = "Grosse bombe! Sautez!",
	},
}

local function GAExperiment(tUnits)
	for unitid, unitdata in pairs(tUnits) do
		local unitname = unitdata.unit:GetName()
		if unitname == Raiderino.L["Experiment X-89"] then
			local castname = Raiderino:GetCast(unitid,unitdata.unit)
			if castname then
				if castname == Raiderino.L["Resounding Shout"] then
					if Raiderino:FeatureCheck("Experiment X-89","Resounding Shout") then
						local msg = {text = "Resounding Shout", maxtime = 25, icon = nil, destroyAtEnd = false}
						Raiderino.timers:AddTimer(msg)
					end
				elseif castname == Raiderino.L["Repugnant Spew"] then
					if Raiderino:FeatureCheck("Experiment X-89","Repugnant Spew") then
						local msg = {text = "Repugnant Spew", maxtime = 40, icon = nil, destroyAtEnd = false}
						Raiderino.timers:AddTimer(msg)
					end
				elseif castname == Raiderino.L["Shattering Shockwave"] then
					if Raiderino:FeatureCheck("Experiment X-89","Shattering Shockwave") then
						local msg = {text = "Shattering Shockwave", maxtime = 19, icon = nil, destroyAtEnd = false}
						Raiderino.timers:AddTimer(msg)
					end
				else
					Raiderino:UntimedCastAdd(unitname,castname)
				end
			end
		end
	end

	if Raiderino:FeatureCheck("Experiment X-89","Corruption Globule") or Raiderino:FeatureCheck("Experiment X-89","Strain Bomb") then
		local player = GameLib.GetPlayerUnit()
		local debuffs = player:GetBuffs().arHarmful
		for _, debuff in pairs(debuffs) do
			if debuff.splEffect:GetName() == Raiderino.L["Corruption Globule"] and Raiderino:FeatureCheck("Experiment X-89","Corruption Globule") then
				if not Raiderino.notifications.content["Small bomb! Go to the edge!"] then
					local msg = {text = "Small bomb! Go to the edge!", maxtime = 5, icon = nil, destroyAtEnd = true}
					Raiderino.notifications:AddTimer(msg)
				end
			elseif debuff.splEffect:GetName() == Raiderino.L["Strain Bomb"] and Raiderino:FeatureCheck("Experiment X-89","Strain Bomb") then
				if not Raiderino.notifications.content["BIG bomb! Jump down!"] then
					local msg = {text = "BIG bomb! Jump down!", maxtime = 15, icon = nil, destroyAtEnd = true}
					Raiderino.notifications:AddTimer(msg)
				end
			end
		end
	end
end

local function PhaseExperiment(phase)

end

local function StartExperiment()

end
----------------------
-- /EXPERIMENT X-89 --
----------------------

local encounteroptions = {
	enabled = true,
	position = 1,
	zone = "Genetic Archives - Act 1",
	fBossFunction = GAExperiment,
	fPhaseFunction = PhaseExperiment,
	fOnStartCombat = StartExperiment,
	features = {
		["Resounding Shout"] = {
			displayname = "Resounding Shout",
			enabled = true
		},
		["Repugnant Spew"] = {
			displayname = "Repugnant Spew",
			enabled = true
		},
		["Shattering Shockwave"] = {
			displayname = "Shattering Shockwave",
			enabled = true
		},
		["Corruption Globule"] = {
			displayname = "Corruption Globule",
			enabled = true
		},
		["Strain Bomb"] = {
			displayname = "Strain Bomb",
			enabled = true
		},
	},
}

if _G["RaiderinoLibs"] == nil then
	_G["RaiderinoLibs"] = { }
end
if _G["RaiderinoLibs"]["Encounters"] == nil then
	_G["RaiderinoLibs"]["Encounters"] = { }
end

_G["RaiderinoLibs"]["Encounters"]["Experiment X-89"] = encounteroptions

if _G["RaiderinoLibs"]["Locales"] == nil then
	_G["RaiderinoLibs"]["Locales"] = { }
end
for locale, localedata in pairs(Locales) do
	if not RaiderinoLibs.Locales[locale] then
		RaiderinoLibs.Locales[locale] = {}
		for i,localestring in pairs(localedata) do
			RaiderinoLibs.Locales[locale][i] = localestring
		end
	end
end